Skip to content

feat(fleet-queue): select enqueue row priority from Drew's label bands (#7030) - #12464

Merged
dezren39 merged 3 commits into
mainfrom
felix/7030-label-band
Nov 22, 2026
Merged

dezren39 merged 3 commits into
mainfrom
felix/7030-label-band

Conversation

@dezren39

@dezren39 dezren39 commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

First slice of #7030 (build item 2, code half): the label→band mapping now exists in the broker.

What was wrong

The broker claims ORDER BY (priority IS NULL), priority ASC, created_at ASC (turso_queue/lifecycle.rs, claim_pick_once) — lowest number first. But no label→band mapping existed anywhere in the enqueue path: task_from_packet copied the packet's stated priority verbatim and never read labels, so the inverted 2026-10-29 values (expedite ⇒ 90, next-up ⇒ 70), applied by external machinery, were stored as-is and Drew's expedited issues were claimed last.

Change (validate.rs only, +106/−1)

  • task_from_packet — the single point where the enqueue row is built — now selects the row priority from the payload's labels array (the same array the claim filter already reads): expedite ⇒ 15 (10–20 band), next-up ⇒ 25 (20–30 band), the stored values Drew ratified 2026-11-07. Expedite outranks next-up if both are present.
  • Labels win over a stated priority: stated values on labeled issues were historically produced by the machinery applying the inverted mapping; the label is Drew's signal, the number is that machinery's output. Documented in the code comment and the validation-contract note.
  • Unlabeled packets are byte-for-byte unchanged (stated value or null). validate_packet still rejects off-scale stated priorities — the derivation happens at row construction, downstream of validation; 15/25 are deliberately off PRIORITY_SCALE, which constrains stated values, not stored rows.

Tests

  • New oracle test label_bands_select_row_priority_7030 (names the fleet-stalling: Drew's expedite set has no active worker #7030 acceptance line): expedite → 15 superseding a stated 90; next-up → 25; both-labels precedence; unrelated/absent labels leave the stated value untouched; unlabeled+unstated stays null; labeled+unstated still selects the band.
  • Fail-before verified in a scratch worktree at the base commit (test present, selection reverted): the expedite case read back 90 instead of 15 — the inversion itself.
  • cargo test -p fleet-queue --all-features: 470 passed, 0 failed; default features 78 passed; rustfmt clean. No pre-existing failures in the crate.

Deliberately out of this slice

  • Re-banding the already-queued expedite set + readback (acceptance item 2's second half) is a live-store operation, separate from the enqueue fix.
  • Producer side: no code in the fleet crates builds issue-task packets from GitHub issues (the monitors live outside this repo), so whether live producers populate payload.labels could not be verified from source. The broker-side contract already reads that key, so the mapping fires whenever labels are present.
  • Brief ratification (acceptance item 1) and the orchestration-pass items are untouched — no reprioritizing happens under this PR.

Run Proof
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

felix added 2 commits November 22, 2026 07:14
…label bands

task_from_packet copied the packet's stated priority verbatim, and
no label→band mapping existed anywhere in the enqueue path — the
90/70 values of the inverted 2026-10-29 design (expedite ⇒ 90)
were produced by machinery outside it, and the broker's
priority-ASC claim order reads them as last.

Now, when the payload's labels array (the array the claim filter's
label field already reads) carries Drew's labels, the band is the
selected row priority: expedite ⇒ 15 (the ratified 10–20 band
value), next-up ⇒ 25 (the ratified 20–30 band value) — the exact
stored values Drew ratified on 2026-11-07, deliberately off
PRIORITY_SCALE, which constrains stated values only. Expedite
outranks next-up when both are present. Unlabeled packets keep
their stated priority (or null) byte-for-byte.
Acceptance oracle, quoted in the test: an expedited issue's task
reads in the 10–20 band in the Turso store. Covers expedite (15,
superseding a stated 90), next-up (25), both-labels precedence,
unrelated/absent labels leaving the stated priority untouched,
and the labeled/unstated and unlabeled/unstated cases.

Verified fail-before: on the base commit with only the selection
reverted, the expedite case reads back 90 instead of 15.
@dezren39
dezren39 requested a review from a team as a code owner November 22, 2026 07:15
@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 20 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 37262e85-a1d2-4e0f-a632-fa193300d7d5
Commits

Reviewing files that changed from the base of the PR and between 6ff6cc5 and 72f7e65.

Files selected for processing: 1

  • pkgs/fleet/crates/fleet-queue/src/validate.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-22T07:16:57.347231Z bc3f662 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dezren39
dezren39 merged commit 0e82202 into main Nov 22, 2026
@dezren39
dezren39 deleted the felix/7030-label-band branch November 22, 2026 07:16

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bc3f662a17

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1196 to +1197
let priority = match label_band_priority(&payload) {
Some(band) => json!(band),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Allow derived priority bands through claim-time validation

Every newly enqueued task carrying expedite or next-up now stores priority 15 or 25, but claim_guard_reason in turso_queue/claim.rs:331 revalidates the stored row with validate_packet, whose PRIORITY_SCALE excludes both values. Consequently, claim_pick_once in turso_queue/lifecycle.rs:436–438 quarantines these tasks instead of handing them to workers, blocking the very issues this change intends to expedite. Distinguish stored-row validation from packet validation so the derived bands pass the claim guard, and cover the enqueue-to-claim path with a regression test.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant